package com.mf.ulits;

import com.baomidou.mybatisplus.extension.service.IService;
import com.mf.service.code.*;
import jakarta.annotation.Resource;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author: lmf
 * @Create: 2024/5/20 20:13
 * Description:  选择股票代码表
 */
public class SelectCodeService {
    @Resource
    private ICode600AService code600AService;

    @Resource
    private ICode600BService code600BService;

    @Resource
    private ICode000Service code000Service;

    @Resource
    private ICode001Service code001Service;

    @Resource
    private ICode002AService code002AService;

    @Resource
    private ICode002BService code002BService;

    @Resource
    private ICode003Service code003Service;
    @Resource
    private ICode300AService code300AService;
    @Resource
    private ICode300BService code300BService;
    @Resource
    private ICode301Service code301Service;
    @Resource
    private ICode601Service code601Service;
    @Resource
    private ICode603Service code603Service;
    @Resource
    private ICode605Service code605Service;

    private final Map<String, IService<?>> serviceMap = new HashMap<>();
    private static final Map<String, Class<?>> dmToClassMap = new HashMap<>();
    public   IService  getServiceByType(String dm) {
        System.out.println(1);
        if (dm.startsWith("600")) {
            if (Integer.parseInt(dm) < 600500) {
                return code600AService;
            } else  {
                return code600BService;
            }
        }else if(dm.startsWith("000")){
            System.out.println(this);
            return code000Service;
        }else if(dm.startsWith("001")){
            return code001Service;
        }else if(dm.startsWith("002")){
            if (Integer.parseInt(dm) < 2500) {
                return code002AService;
            } else  {
                return code002BService;
            }
        }else if(dm.startsWith("003")){
            return code003Service;
        }else if(dm.startsWith("300")){
            if (Integer.parseInt(dm) < 300500) {
                return code300AService;
            } else  {
                return code300BService;
            }
        }else if(dm.startsWith("301")){
            return code301Service;
        }else if(dm.startsWith("601")){
            return code601Service;
        }else if(dm.startsWith("603")){
            return code603Service;
        }else if(dm.startsWith("605")){
            return code605Service;
        }
        return null;
    }
}
